home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / include / x11 / xstreams.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-11  |  5.5 KB  |  218 lines

  1. /* $XConsortium: Xstreams.h,v 1.6 91/07/19 23:22:53 gildea Exp $ */
  2. /*    Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
  3. /*    Copyright (c) 1988 AT&T */
  4. /*      All Rights Reserved    */
  5.  
  6. /*
  7.  * Permission to use, copy, modify, and distribute this software and its
  8.  * documentation for any purpose and without fee is hereby granted, provided
  9.  * that the above copyright notice appear in all copies and that both that
  10.  * copyright notice and this permission notice appear in supporting
  11.  * documentation, and that the name of AT&T or USL not be used in advertising
  12.  * or publicity pertaining to distribution of the software without specific,
  13.  * written prior permission.  AT&T and USL make no representations about the
  14.  * suitability of this software for any purpose.  It is provided "as is"
  15.  * without express or implied warranty.
  16.  *
  17.  * AT&T and USL DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  18.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  19.  * NO EVENT SHALL AT&T or USL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  21.  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  22.  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  23.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  */
  25.  
  26.  
  27. #ifndef _XSTREAMS_H_
  28. #define _XSTREAMS_H_
  29. /*
  30.  Xstreams.h (C header file)
  31.     Acc: 575304412 Tue Apr 26 09:46:52 1988
  32.     Mod: 574017273 Tue Apr 26 12:14:33 1988
  33.     Sta: 574017273 Tue Apr 26 12:14:33 1988
  34.     Owner: 2011
  35.     Group: 1985
  36.     Permissions: 644
  37. */
  38. /*
  39.     START USER STAMP AREA
  40. */
  41. /*
  42.     END USER STAMP AREA
  43. */
  44.  
  45.  
  46.  
  47. #define    MEM_ALLIGN(ptr) ((((unsigned) (ptr + 3)) >> 2) << 2)
  48.  
  49. #define    CONNECT_TIMEOUT        60
  50. #define    MAX_AUTO_BUF_LEN    256
  51. #define    MAX_DISP_DIGITS        20
  52. #define    MAX_NETS    8
  53.  
  54. typedef struct _host {
  55.     char    host_name[32];
  56.     int    host_len;
  57.     struct _host *next;
  58. } HOST;
  59.  
  60. /*
  61.  * Structure for handling multiple connection requests on the same stream.
  62.  */
  63.  
  64. struct listenCall {
  65.     struct t_call *CurrentCall;
  66.     struct listenCall *NextCall;
  67. };
  68.  
  69. struct listenQue {
  70.     struct listenCall *QueHead;
  71.     struct listenCall *QueTail;
  72. };
  73.  
  74. #define EMPTY(p)    (p->QueHead == (struct listenCall *) NULL)
  75.  
  76.  
  77. typedef struct {
  78.     int    flags;
  79.     char    type;
  80.     int    display;
  81.     char    *inputbuf;
  82.     int    buflen;
  83.     int    bufptr;
  84.     int    msglen;
  85.     } IOBUFFER;
  86.  
  87. typedef struct {
  88.     int    _nnets;
  89. #ifdef SVR4
  90.     struct netconfig *_net[MAX_NETS];
  91. #else
  92.     char    *_net[MAX_NETS];
  93. #endif
  94.         struct listenQue FreeList[MAX_NETS];
  95.     struct listenQue PendingQue[MAX_NETS];
  96.     int    _npeers;
  97.     char    **_peer;
  98.     int    *_peerlen;
  99.     HOST    *_validhosts;
  100.     } networkInfo;
  101.  
  102.  
  103. typedef struct _Xstream {
  104.     int    (*SetupTheListener)();
  105.     int    (*ConnectNewClient)();
  106.     int    (*CallTheListener)();
  107.     int    (*ReadFromStream)();
  108.     int    (*BytesCanBeRead)();
  109.     int    (*WriteToStream)();
  110.     int    (*CloseStream)();
  111.     int    (*CreateAddress)();
  112.     union ext {
  113.         int    (*NameServer)();
  114.         networkInfo *NetInfo;
  115.         } u;    
  116.     } Xstream;
  117.  
  118. /* old shared libraries have the names already fixed */
  119. #ifdef USL_COMPAT
  120. #define _XsStream        xstream
  121. #define _XReadV            _readv
  122. #define _XWriteV        _writev
  123. #define _XSelect         XSelect
  124. #define _XsErrorCall        ErrorCall        
  125. #define    _XsSetupLocalStream    SetupLocalStream
  126. #define    _XsConnectLocalClient    ConnectLocalClient
  127. #define    _XsOpenSpServer        OpenSpServer
  128. #define    _XsReadLocalStream    ReadLocalStream
  129. #define    _XsConnectTliClient    ConnectTliClient
  130. #define _XsSetupTliStrean    SetupTliStream
  131. #define _XsCallTliServer    CallTliServer
  132. #define    _XsCallLocalServer    CallLocalServer
  133. #define _XsTypeOfStream        TypeOfStream
  134. #ifdef SVR4
  135. #define    _XsSetupNamedStream    SetupNamedStream
  136. #define _XsSetupSpStream    SetupSpStream
  137. #endif /* SVR4 */
  138. #endif /* USL_COMPAT */
  139.  
  140. extern Xstream _XsStream[];
  141.  
  142. #define NO_BUFFERING    0
  143. #define BUFFERING    1
  144.  
  145. /* Network services */
  146.  
  147. #define OpenDaemonConnection    0
  148. #define    PEER_NAME        1
  149. #define    PEER_ALLOC        2
  150. #define    PEER_FREE        3
  151. #define    ConvertNetAddrToName    4
  152. #define    ConvertNameToNetAddr    5
  153. #define    ConvertNameToTliCall    6
  154. #define    ConvertTliCallToName    7
  155. #define    ConvertNameToTliBind    8
  156.  
  157. #define    UNAME_LENGTH    14
  158.  
  159. #define X_LOCAL_STREAM    0
  160. #define X_NAMED_STREAM    1
  161. /* Enhanced Application Compatibility Support */
  162. #define X_SP_STREAM    2
  163. /* End Enhanced Application Compatibility Support */
  164.  
  165. #define X_TLI_STREAM    3
  166. #define CLOSED_STREAM    -1
  167.  
  168. /*
  169.     The following are defined in X.h. Any changes to FamilyUname
  170.     should take X.h into consideration.
  171. */
  172.         /* protocol families */
  173.  
  174.         /*
  175.  
  176.         #define FamilyInternet        0
  177.         #define FamilyDECnet        1
  178.         #define FamilyChaos        2
  179.  
  180.         */
  181.  
  182. #define FamilyUname    3
  183.  
  184. #define X_TCP_PORT        6000
  185.  
  186. #define NAMED_LISTENER "/dev/X/Nserver"
  187. #define LOCAL_LISTENER "/dev/X/server"
  188. /* Enhanced Application Compatibility Support */
  189. /* End Enhanced Application Compatibility Support */
  190.  
  191. #define    NAME_SERVER_NODE "/dev/X/nameserver"
  192. #define XNETSPECDIR    "lib/net"
  193. #define XROOTDIR "/usr/X"
  194.  
  195. #define    MAX_SIMUL_TLI_CALLS    20
  196.  
  197. #define SetupNetworkInfo()   _XsStream[X_LOCAL_STREAM].u.NetInfo = &Network; \
  198.     _XsStream[X_NAMED_STREAM].u.NetInfo = &Network; \
  199. /* Enhanced Application Compatibility Support */ \
  200. /* End Enhanced Application Compatibility Support */ \
  201.     _XsStream[X_TLI_STREAM].u.NameServer = nameserver
  202.  
  203. #define NetworkInfo (_XsStream[X_LOCAL_STREAM].u.NetInfo)
  204. #define GetNetworkInfo (*_XsStream[X_TLI_STREAM].u.NameServer)
  205. #define validhosts _XsStream[X_LOCAL_STREAM].u.NetInfo->_validhosts
  206.  
  207. /*
  208.  *    header of messages sent by X to the nameserver 
  209.  *      1st int: the size of the entire message.
  210.  *    2nd int: the size of the header itself.
  211.  *      3rd int: the service number.
  212.  *      4th int: the display number.
  213.  *     5th int: the length of the network name.
  214.  */
  215.  
  216. #define HEADERSIZE    (5*sizeof(int))
  217. #endif /* _XSTREAMS_H_ */
  218.